const BASEURL = 'https://www.uinav.com/api/public/v1/'

const request=({url,method='get',data={},header,tip='正在加载中'})=>{
return new Promise((resolve,reject)=>{
      uni.showLoading({
        title: tip,
        mask: true
      })
  
    uni.request({
        url: `${BASEURL}${url}`,
        method,
        header,
        data,
        // sslVerify: true,
        success: ({ data, statusCode, header }) => {
            resolve(data)
        },
        fail: (error) => {
            reject(error)
        },
        complete:()=>{
        uni.hideLoading()
        }
    })

})
}

uni.$request = request